

// 定义工序优化策略接口
export default  class StrategyEntity {
    applyOptimization() {
        throw new Error("子类需要实现applyOptimization方法");
    }
}

// 工序优化策略实现类1
class OptimizationStrategy1 extends StrategyEntity {
    applyOptimization() {
        console.log("应用工序优化策略1");
        // 实际优化逻辑
    }
}

// 工序优化策略实现类2
class OptimizationStrategy2 extends StrategyEntity {
    applyOptimization() {
        console.log("应用工序优化策略2");
        // 实际优化逻辑
    }
}

// 工序优化策略列表类
class ProductionLineOptimizer {
    constructor() {
        this.strategies = [];
    }

    // 添加优化策略
    addStrategy(strategy) {
        this.strategies.push(strategy);
    }

    // 应用所有优化策略
    applyAllStrategies() {
        this.strategies.forEach(strategy => strategy.applyOptimization());
    }
}
//
// // 使用示例
// let strategy1 = new OptimizationStrategy1();
// let strategy2 = new OptimizationStrategy2();
//
// let optimizer = new ProductionLineOptimizer();
// optimizer.addStrategy(strategy1);
// optimizer.addStrategy(strategy2);
//
// optimizer.applyAllStrategies();
